import { IPSSearchBarQuickSearch } from './ipssearch-bar-quick-search';
import { PSSysSearchBarItemImplBase } from './pssys-search-bar-item-impl-base';
import { IPSDEFSearchMode } from '../../dataentity/defield/ipsdefsearch-mode';

export class PSSysSearchBarQuickSearchImpl extends PSSysSearchBarItemImplBase implements IPSSearchBarQuickSearch {
  protected psdefsearchmode: IPSDEFSearchMode | null = null;

  getPSDEFSearchMode(): IPSDEFSearchMode | null {
    if (this.psdefsearchmode != null) return this.psdefsearchmode;
    const value = this.M.getPSDEFSearchMode;
    if (value == null) {
      return null;
    }
    this.psdefsearchmode = this.getPSModel4('dataentity.defield.IPSDEFSearchMode', value, 'getPSDEFSearchMode') as IPSDEFSearchMode;
    return this.psdefsearchmode;
  }

  get psDEFSearchMode(): IPSDEFSearchMode | null {
    return this.getPSDEFSearchMode();
  }

  getPSDEFSearchModeMust(): IPSDEFSearchMode {
    const value = this.getPSDEFSearchMode();
    if (value == null) {
      throw new Error('未指定属性搜索模式');
    }
    return value;
  }

  get cls(): string {
    return 'PSSysSearchBarQuickSearchImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'control.searchbar.IPSSearchBarQuickSearch') return true;
    return super.instanceof(cls);
  }
}
